package com.rupertjones.globalcron.resources;

import org.brownflat.dbinit.upgrade.Upgrade;
import org.springframework.stereotype.Component;

/**
 * <p>&copy Rupert Jones 2011,2012</p>
 *
 * @author rup
 */
@Component
public class Upgrade0016Settings implements Upgrade {
    @Override
    public int getSequence() {
        return 16;
    }

    @Override
    public String getSql() {
        return  "CREATE TABLE `setting` (\n" +
                "  `id` int(11) NOT NULL AUTO_INCREMENT,\n" +
                "  `name` varchar(100) NOT NULL,\n" +
                "  `type` varchar(100) NOT NULL,\n" +
                "  `value_type` varchar(100) NOT NULL,\n" +
                "  `setting_value` varchar(255) DEFAULT NULL,\n" +
                "  `description` varchar(255) NOT NULL," +
                "   PRIMARY KEY (`id`)) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;" +
                "INSERT INTO setting (name, type, value_type, setting_value, description) VALUES ('Allow ad hoc Execution','ALLOW_AD_HOC_EXECUTION','java.lang.Boolean','true','Allow jobs to be executed ad hoc.');" +
                "INSERT INTO setting (name, type, value_type, setting_value, description) VALUES ('Allow raw commands','ALLOW_RAW_COMMAND','java.lang.Boolean','true','Allow jobs to be a command rather than a script.');";
    }

    @Override
    public String getName() {
        return "Add system settings";
    }
}
